package com.pand.model.vehicle;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 *
 * @ClassName: VehicleRealData
 * @Description: 车辆实时数据
 * @author zouyan
 * @date 2017年3月7日 下午5:11:44 
 *
 */
@Entity
@Table(name = "BIZ_VEHICLE_REAL_DATA")
public class VehicleRealData implements Serializable {

	/**
	 * @Fields serialVersionUID : 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 主键
	 */
	private String id;

	/**
	 * 车架号
	 */
	private String vin;

	/**
	 * 车门状态
	 */
	private Integer door;

	/**
	 * 累计里程
	 */
	private Double odo;

	/**
	 * 电池电量
	 */
	private Double soc;

	/**
	 * 续航里程
	 */
	private Double range;

	/**
	 * 车辆状态
	 */
	private Integer online;

	/**
	 * 档位
	 */
	private String gear;

	/**
	 * 点火钥匙位置
	 */
	private Integer acc;

	/**
	 * 手刹状态
	 */
	private Integer handbrake;

	/**
	 * Can总线状态
	 */
	private Integer canBus;

	/**
	 * 定位卫星状态
	 */
	private Integer gpsStatus;

	/**
	 * 蓝牙状态
	 */
	private Integer bluetoothStatus;

	/**
	 * Wifi状态
	 */
	private Integer wifiStatus;

	/**
	 * 限速状态
	 */
	private Integer speedLimitState;

	/**
	 * 限制转速
	 */
	private Integer limitingSpeed;

	/**
	 * 数据更新时间
	 */
	private Date updateTime;

	/**
	 * 推送时间
	 */
	private Date pushTime;
	/**
	 * 消息唯一标识
	 */
	private String uuid;

	/**
	 * 经度
	 */
	private Double longtitude;

	/**
	 * 纬度
	 */
	private Double latitude;


	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid")
	@Column(name = "ID")
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "VIN")
	public String getVin() {
		return vin;
	}
	public void setVin(String vin) {
		this.vin = vin;
	}

	@Column(name = "DOOR")
	public Integer getDoor() {
		return door;
	}
	public void setDoor(Integer door) {
		this.door = door;
	}

	@Column(name = "ODO")
	public Double getOdo() {
		return odo;
	}
	public void setOdo(Double odo) {
		this.odo = odo;
	}

	@Column(name = "SOC")
	public Double getSoc() {
		return soc;
	}
	public void setSoc(Double soc) {
		this.soc = soc;
	}

	@Column(name = "RANGE")
	public Double getRange() {
		return range;
	}
	public void setRange(Double range) {
		this.range = range;
	}

	@Column(name = "ON_LINE")
	public Integer getOnline() {
		return online;
	}
	public void setOnline(Integer online) {
		this.online = online;
	}

	@Column(name = "GEAR")
	public String getGear() {
		return gear;
	}
	public void setGear(String gear) {
		this.gear = gear;
	}

	@Column(name = "ACC")
	public Integer getAcc() {
		return acc;
	}
	public void setAcc(Integer acc) {
		this.acc = acc;
	}

	@Column(name = "HANDBRAKE")
	public Integer getHandbrake() {
		return handbrake;
	}
	public void setHandbrake(Integer handbrake) {
		this.handbrake = handbrake;
	}

	@Column(name = "CAN_BUS")
	public Integer getCanBus() {
		return canBus;
	}
	public void setCanBus(Integer canBus) {
		this.canBus = canBus;
	}

	@Column(name = "GPS_STATUS")
	public Integer getGpsStatus() {
		return gpsStatus;
	}
	public void setGpsStatus(Integer gpsStatus) {
		this.gpsStatus = gpsStatus;
	}

	@Column(name = "BLUETOOTH_STATUS")
	public Integer getBluetoothStatus() {
		return bluetoothStatus;
	}
	public void setBluetoothStatus(Integer bluetoothStatus) {
		this.bluetoothStatus = bluetoothStatus;
	}

	@Column(name = "WIFI_STATUS")
	public Integer getWifiStatus() {
		return wifiStatus;
	}
	public void setWifiStatus(Integer wifiStatus) {
		this.wifiStatus = wifiStatus;
	}

	@Column(name = "SPEED_LIMIT_STATE")
	public Integer getSpeedLimitState() {
		return speedLimitState;
	}
	public void setSpeedLimitState(Integer speedLimitState) {
		this.speedLimitState = speedLimitState;
	}

	@Column(name = "LIMITING_SPEED")
	public Integer getLimitingSpeed() {
		return limitingSpeed;
	}

	public void setLimitingSpeed(Integer limitingSpeed) {
		this.limitingSpeed = limitingSpeed;
	}

	@Column(name = "UPDA_TETIME")
	public Date getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Date updateTime) {
		if(updateTime!=null && this.updateTime!=null){
			if(updateTime.getTime()>this.updateTime.getTime()){
				this.updateTime = updateTime;
			}
		}else if(this.updateTime==null){
			this.updateTime = updateTime;
		}

	}

	@Column(name = "PUSH_TIME")
	public Date getPushTime() {
		return pushTime;
	}
	public void setPushTime(Date pushTime) {
		this.pushTime = pushTime;
	}

	@Transient
	public String getUuid() {
		return uuid;
	}
	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public String toString() {
		return "VehicleRealData [vin=" + vin + ", door=" + door + ", odo=" + odo + ", soc=" + soc + ", range=" + range
				+ ", online=" + online + ", gear=" + gear + ", acc=" + acc + ", handbrake=" + handbrake + ", canBus="
				+ canBus + ", gpsStatus=" + gpsStatus + ", bluetoothStatus=" + bluetoothStatus + ", wifiStatus="
				+ wifiStatus + ", speedLimitState=" + speedLimitState + ", limitingSpeed=" + limitingSpeed
				+ ", updateTime=" + updateTime + ", pushTime=" + pushTime +"uuid"+uuid+ "]";
	}

	@Column(name = "longtitude")
	public Double getLongtitude() {
		return longtitude;
	}
	public void setLongtitude(Double longtitude) {
		this.longtitude = longtitude;
	}

	@Column(name = "latitude")
	public Double getLatitude() {
		return latitude;
	}
	public void setLatitude(Double latitude) {
		this.latitude = latitude;
	}



}
